package com.ruoyi.job.task;

import cn.hutool.core.date.StopWatch;
import com.alibaba.fastjson.JSON;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.job.domain.OaPerson;
import com.ruoyi.job.remote.FeignUserService;
import com.ruoyi.job.service.OaUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author wangsr
 * @date 2021-12-20 16:29
 * @description
 */
@Component("oaTask")
@Slf4j
@RestController
public class OaUserTask {
    @Autowired
    private OaUserService oaUserService;

//    @Autowired
//    private ISysUserService userService;


    @Autowired
    private FeignUserService feignUserService;

    @GetMapping("/test")
    public Object syncOaUser() {

        StopWatch stopWatch = new StopWatch();
        stopWatch.start("查询系统用户数据");
        List<OaPerson> people = oaUserService.selectAllUser();
        AjaxResult job = feignUserService.syncOaUser(people, "job");
        stopWatch.stop();
        System.out.println(stopWatch.prettyPrint());
        return job;
    }
}
